[Unit]
Description=Apache Kafka
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target
After=network.target

[Service]
Type=simple
StandardOutput=null
Environment="KAFKA_HEAP_OPTS={{ kafka_java_heap }}"
Environment="LOG_DIR={{ kafka_log_dir }}"
{% if kafka_opts is defined %}
Environment="KAFKA_OPTS={{ kafka_opts }}"
{% endif %}
{% if kafka_extra_args is defined %}
Environment="EXTRA_ARGS={{ kafka_extra_args }}"
{% endif %}
{% if kafka_jmx_port is defined %}
Environment="JMX_PORT={{ kafka_jmx_port }}"
{% endif %}
ExecStart={{ kafka_dir }}/bin/kafka-server-start.sh /etc/kafka/server.properties
ExecStop={{ kafka_dir }}/bin/kafka-server-stop.sh
User={{ kafka_user }}
Group={{ kafka_group }}
Restart=on-failure
LimitNOFILE=infinity
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
Alias=kafka.service
